
package main.java.handler;
import main.java.RowProcessor;

import java.sql.ResultSet;
import java.sql.SQLException;

public class ColumnHandler implements ResultSetHandler<Object> {

    private int columnIndex;
    //private Class<T> type;

    public ColumnHandler(int columnIndex){
        this.columnIndex = columnIndex;
        //this.type = type;
    }

    @Override
    public Object handle(ResultSet rs) throws SQLException {
        return rs.next()? RowProcessor.toValue(rs,columnIndex):null;
    }
}
